cmake_minimum_required(VERSION 3.5)
project(MarkDown_CPP)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -fPIC -rdynamic -O0 -ggdb -std=c++11 -Wall -Wno-deprecated -Werror -Wno-unused-function -Wno-builtin-macro-redefined -Wno-deprecated-declarations")

include_directories(.)
include_directories(/usr/local/include/)
include_directories(/usr/include/x86_64-linux-gnu/qt5/)

find_package(Qt5 COMPONENTS Core Gui Widgets WebEngineWidgets Pdf REQUIRED)
find_package(Boost REQUIRED COMPONENTS json)
set(LIB_SRC
        src/log/log.cpp
        src/utils/utils.cpp
        src/widgets/MainWindows.h
        src/widgets/MainWindows.cpp
        src/widgets/MenuBar.h
        src/widgets/MenuBar.cpp
        src/widgets/SideBarWindow.h
        src/widgets/SideBarWindow.cpp
        src/widgets/EditorWindow.cpp
        src/widgets/EditorWindow.h
        src/widgets/SideContentWindow.h
        src/widgets/SideContentWindow.cpp
        src/widgets/Config.h
        src/widgets/Config.cpp
        src/widgets/NoteBookButton.cpp
        src/widgets/NoteBookButton.h
        src/main.cpp
        src/widgets/NoteBookDirButton.cpp
        src/widgets/NoteBookDirButton.h
        src/widgets/SearchButton.cpp
        src/widgets/SearchButton.h
        src/widgets/NoteBookNavigationWindow.cpp
        src/widgets/NoteBookNavigationWindow.h
        src/widgets/HeadFiles.h
        src/widgets/NavigationWindows.cpp
        src/widgets/NavigationWindows.h
        src/widgets/NoteBookDirNavigationWindow.cpp
        src/widgets/NoteBookDirNavigationWindow.h
        src/widgets/SearchNavigationWindow.cpp
        src/widgets/SearchNavigationWindow.h
        src/widgets/FileManager.cpp
        src/widgets/FileManager.h
        tests/test_FileMgr.cpp
        src/widgets/FileManager.cpp
        src/widgets/FileManager.h
        src/widgets/MarkdownWindow.cpp
        src/widgets/MarkdownWindow.h
        src/widgets/EditorBase.cpp
        src/widgets/EditorBase.h
        src/widgets/LineNumberArea.cpp
        src/widgets/LineNumberArea.h
        src/widgets/TextEdit.cpp
        src/widgets/TextEdit.h
        src/KeyPressFilter.cpp
        src/KeyPressFilter.h
        src/widgets/CPPCodeHighLight.h
        src/widgets/CppWindow.cpp
        src/widgets/CppWindow.h
        src/widgets/MarkDonwCodeHighLight.h
        src/widgets/HtmlCodeHighLight.h
        src/widgets/HtmlWindow.cpp
        src/widgets/HtmlWindow.h
        src/widgets/HWindow.cpp
        src/widgets/HWindow.h
        src/widgets/XMLWindow.cpp
        src/widgets/XMLWindow.h
        src/widgets/JsonWindow.cpp
        src/widgets/JsonWindow.h
        src/widgets/JsonCodeHighLight.h
        src/widgets/XMLCodeHighLight.h
        src/widgets/HCodeHighLight.h
        src/utils/MarkDownParser.cpp
        src/utils/MarkDownParser.h
        src/widgets/TabWidgetMoreButton.cpp
        src/widgets/TabWidgetMoreButton.h
        src/widgets/MarkDownPreviewButton.cpp
        src/widgets/MarkDownPreviewButton.h
        src/widgets/MarkDownEditButton.cpp
        src/widgets/MarkDownEditButton.h
        src/widgets/MarkDownPreviewAndEditButton.cpp
        src/widgets/MarkDownPreviewAndEditButton.h
        src/widgets/TreeWidgetItem.cpp
        src/widgets/TreeWidgetItem.h
        src/widgets/AddNoteBookDialog.cpp
        src/widgets/AddNoteBookDialog.h
        src/widgets/LineInputer.cpp
        src/widgets/LineInputer.h
        src/widgets/ChooseOrCancelButton.cpp
        src/widgets/ChooseOrCancelButton.h
        src/widgets/DataDef.h
        src/widgets/OpenNoteBookDialog.cpp
        src/widgets/OpenNoteBookDialog.h
        src/widgets/AddNoteDialog.cpp
        src/widgets/AddNoteDialog.h
)


add_library(MarkDown_CPP ${LIB_SRC})

set(LIB_LIB
        MarkDown_CPP
        Qt5::Core
        Qt5::Widgets
        Qt5::Gui
        Qt5::WebEngineWidgets
        Qt5::Pdf
        Boost::json
)

add_executable(test tests/test.cpp)
target_link_libraries(test ${LIB_LIB})

add_executable(test_ui tests/test_ui.cpp)
target_link_libraries(test_ui ${LIB_LIB})

add_executable(test_demo tests/test_demo.cpp)
target_link_libraries(test_demo ${LIB_LIB})

add_executable(test_FileMgr tests/test_FileMgr.cpp)
target_link_libraries(test_FileMgr ${LIB_LIB})

add_executable(test_Edit tests/test_Edit.cpp)
target_link_libraries(test_Edit ${LIB_LIB})

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)